<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="node_modules/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
<!-- v-on :注册事件  -->
        <h1>{{num}}</h1>

        <h1>使用事件让num改变</h1>
        <button v-on:click="selfAdd">自增</button> <br/>
        <button @click="selfReduce" >自减</button>
    </div>
</body>
    <script>
        new Vue({
            el:"#app",
            data:{
                num:20
            },
            methods:{
                selfAdd(){
                    this.num++;
                },
                selfReduce(){
                    this.num--;
                }
            }
        })
    </script>
</html>